﻿namespace Blaze.Editor.AssetValidators
{
    using System.Linq;
    using UnityEngine;

    /// <summary>
    /// 只使用手机平台的Shader。
    /// </summary>
    public class MobilePlatformShader : AssetValidator
    {
        public override void Check(Object asset)
        {
            var material = (Material) asset;
            if (mShaders.Contains(material.shader.name))
                Logger.ErrorFormat("使用了非手机平台的Shader：" + material.shader.name);
        }

        public override bool Precheck(string assetPath)
        {
            return assetPath.EndsWith(".mat");
        }

        private static readonly string[] mShaders =
        {
            "Standard",
            "Standard (Specular setup)",
        };
    }
}